import {getPreCommentList} from  '../../../api/teacher/evalute'
Component({
  data:{
    studentList:[],
    currentIndex:0,
    avatar:"",
  },
  methods:{
  onShow(){
  },
  onLoad(data:any){
  const {seriesId} = data
  this.setData({
    seriesId
  })
  this.requireEvaluteInfo()
  },
  // 获取课程待评价课程列表
  async requireEvaluteInfo(){
    try {
    const seriesId = this.data.seriesId as any
    const  userId = getApp().getUserInfo().userId 
   const {code,data:res} = await getPreCommentList({
    seriesId,userId
   })
   if(code === 200){
    this.setData({
      studentList:res
    })
   }
    } catch (error) {
      
    }
  },
  arrow(e:any){
    const {type} = e.currentTarget.dataset
     let currentIndex = this.data.currentIndex
     const len = this.data.studentList.length
     switch(type){
       case 'left':
        if(currentIndex > 0){
          currentIndex--
         }
        break;
        case 'right':
          if(currentIndex < len - 1){
            currentIndex++
           }
        break;
     }
    this.setData({
      currentIndex
    })
  },
  // 填写学员状态
  changeStudentStatus(e:any){
    const {props,value} = e.detail
    switch(props){
      case "content":
        this.setData({
          content:value
        })
      break;
      case "stuStatus":
        this.setData({
          stuStatus:value
        })
    }

  },
  
  // 保存课程
  saveEvaluate(){
   console.log("保存的课程信息",this.data.formData);
   const formData = {} as any
   formData.content = this.data.content
   formData.stuStatus = this.data.stuStatus
   console.log("此时阿白哦但",formData);
   
  },
  // 选择评分
  commentScore(){
    
  }
  }
})